package org.design.thread.two;

import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * OrderEventListener
 * 事件监听（ApplicationEventPublisher）
 * 适用场景：系统解耦，异步处理事件
 * 监听处理
 *
 * @author 樊温军
 * @date 2025/6/13 下午5:34
 */
@Component
public class OrderEventListener {

    @Async("taskExecutor")
    @EventListener
    public void handleOrderCreatedEvent(OrderCreatedEvent event) {
        System.out.println("处理订单后续操作，订单ID：" + event.getOrderId());
    }
}

